Add DMD2 distillation for Qwen-Image (fastgen) - #1326
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Type of change: New example + new
modelopt.torch.fastgenlibrary module.Adds DMD2 (Distribution Matching Distillation) for Qwen-Image — distilling the base model into a few-step (1–4) generator. Includes the framework-agnostic
modelopt.torch.fastgenloss library (DMD pipeline, EMA, optional GAN discriminator) and a NeMo AutoModel–based training example with a mock-data smoke config, a real-data config, and inference / export scripts.Noted: the example script will be migrated to AutoModel repo
Usage
# Mock-data wiring smoke — runs end-to-end with no dataset to prepare torchrun --nproc-per-node=8 \ examples/diffusers/fastgen/dmd2_finetune.py \ --config examples/diffusers/fastgen/configs/dmd2_qwen_image_smoke.yamlSee
examples/diffusers/fastgen/README.mdfor real-data training and inference.Testing
Unit tests under
tests/unit/torch/fastgen/;pre-commit/ code-quality clean.Before your PR is "Ready for review"
CONTRIBUTING.mdfor any copied code / new deps: ✅Summary by CodeRabbit
New Features
Documentation
Tests